#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
vector<int>ans;
const int N = 1e3 + 10;
map<int, int>mp, mp1, mp2, mp4;
int a[N * N];
vector<int>ans;
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		ans.clear();
		mp.clear();
		mp1.clear();
		mp2.clear();
		mp4.clear();
		int x;
		int cnt = 0;
		int cnt1 = 0;
		for (int i = 0; i < (n * (n - 1)) / 2; i++) {
			cin >> x;
			ans.push_back(x);
			mp[x]++;
			cnt++;
			if (!mp4[x]) {
				mp4[x] = 1;
				cout << x << " ";
				cnt1++;
			}
		}
		sort(ans.begin(), ans.end());
		for (int i = cnt - 1; i >= 0; i--) {
			if (!mp1[a[i]]) {
				mp1[a[i]] = 1;
				mp2[a[i]] = mp2[a[i + 1]] + mp[a[i]];
				for (int i = 0; i < mp2[a[i]]; i++) {
					cout << a[i] << " ";
					cnt1++;
				}
				if (cnt1 == n)break;
			}
		}
	}
	return 0;
}